refactor(runtime): 第一阶段剥离 context 模块#102
Merged
minorcell merged 3 commits intoApr 1, 2026
Merged
Conversation
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
minorcell
reviewed
Apr 1, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
概要
internal/runtime中的 system prompt 构建与消息裁剪逻辑抽离到独立的internal/context模块context.Builder,保持 provider、tools 和 TUI 的外部行为不变背景
Issue #101 的目标是先完成第一阶段的“行为等价迁移”,把上下文构建职责从 ReAct 主循环中剥离出来,为后续规则文件注入、compact 和 memory 等能力预留清晰扩展点。
主要改动
internal/context,提供Builder、BuildInput、BuildResult、默认 prompt 构建和按 span 裁剪消息的实现internal/app中注入默认 context builder,并由 runtime 在每轮请求前统一构建上下文Provider.Chat前使用 builder 输出internal/context的职责说明验证
go test ./...说明
AGENTS.md发现、memory、compact 或 tool schema 传递方式的调整